home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / ShutDown.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  2.9 KB  |  110 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ShutDown.h
  3.  
  4.      Contains:    Shutdown Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1987-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __SHUTDOWN__
  19. #define __SHUTDOWN__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50.  
  51. enum {
  52.     sdOnPowerOff                = 1,                            /*call procedure before power off.*/
  53.     sdOnRestart                    = 2,                            /*call procedure before restart.*/
  54.     sdOnUnmount                    = 4,                            /*call procedure before unmounting.*/
  55.     sdOnDrivers                    = 8,                            /*call procedure before closing drivers.*/
  56.     sdOnBootVolUnmount            = 16,                            /*call procedure before unmounting boot volume and VM volume but after unmounting all other volumes*/
  57.     sdRestartOrPower            = 3                                /*call before either power off or restart.*/
  58. };
  59.  
  60. typedef CALLBACK_API( void , ShutDwnProcPtr )(short shutDownStage);
  61. /*
  62.     WARNING: ShutDwnProcPtr uses register based parameters under classic 68k
  63.              and cannot be written in a high-level language without 
  64.              the help of mixed mode or assembly glue.
  65. */
  66. typedef REGISTER_UPP_TYPE(ShutDwnProcPtr)                         ShutDwnUPP;
  67. enum { uppShutDwnProcInfo = 0x00001002 };                         /* register no_return_value Func(2_bytes:D0) */
  68. #define NewShutDwnProc(userRoutine)                             (ShutDwnUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppShutDwnProcInfo, GetCurrentArchitecture())
  69. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  70.     #pragma parameter CallShutDwnProc(__A0, __D0)
  71.     void CallShutDwnProc(ShutDwnUPP routine, short shutDownStage) = 0x4E90;
  72. #else
  73.     #define CallShutDwnProc(userRoutine, shutDownStage)         CALL_ONE_PARAMETER_UPP((userRoutine), uppShutDwnProcInfo, (shutDownStage))
  74. #endif
  75. EXTERN_API( void )
  76. ShutDwnPower                    (void)                                                        THREEWORDINLINE(0x3F3C, 0x0001, 0xA895);
  77.  
  78. EXTERN_API( void )
  79. ShutDwnStart                    (void)                                                        THREEWORDINLINE(0x3F3C, 0x0002, 0xA895);
  80.  
  81. EXTERN_API( void )
  82. ShutDwnInstall                    (ShutDwnUPP             shutDownProc,
  83.                                  short                     flags)                                THREEWORDINLINE(0x3F3C, 0x0003, 0xA895);
  84.  
  85. EXTERN_API( void )
  86. ShutDwnRemove                    (ShutDwnUPP             shutDownProc)                        THREEWORDINLINE(0x3F3C, 0x0004, 0xA895);
  87.  
  88.  
  89.  
  90. #if PRAGMA_STRUCT_ALIGN
  91.     #pragma options align=reset
  92. #elif PRAGMA_STRUCT_PACKPUSH
  93.     #pragma pack(pop)
  94. #elif PRAGMA_STRUCT_PACK
  95.     #pragma pack()
  96. #endif
  97.  
  98. #ifdef PRAGMA_IMPORT_OFF
  99. #pragma import off
  100. #elif PRAGMA_IMPORT
  101. #pragma import reset
  102. #endif
  103.  
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107.  
  108. #endif /* __SHUTDOWN__ */
  109.  
  110.